package Demo4.Game;

/**
 * 2023/7/13 15:19
 **/
public class Monster {

    private String nickName;
    private int level;
    private int blood;
    private int power;
    private int defence;
    private String kind;

    //基本攻击方法
    public void attack(Hero h){
        //英雄的失血量 = 怪兽的攻击力 - 英雄的防御力
        int blood = this.power - h.getDefence();
        if(blood>=0){
            h.setBlood(h.getBlood() - blood);
            System.out.println("英雄本回合失血量："+blood+"，剩余血量："+h.getBlood());
        }else{
            System.out.println("此回合攻击无效");
        }
    }

    //死亡判定方法
    public boolean isDead(){
        if(this.blood<=0){
            System.out.println("当前怪兽已死亡~");
            return true;
        }
        return false;
    }

    //获取怪兽信息的方法
    public void show(){
        System.out.println("怪兽的昵称："+nickName);
        System.out.println("怪兽的等级："+level);
        System.out.println("怪兽的血量："+blood);
        System.out.println("怪兽的攻击力："+power);
        System.out.println("怪兽的防御力："+defence);
        System.out.println("怪兽的类别："+kind);
    }

    public Monster() {
    }

    public Monster(String nickName, int level, int blood, int power, int defence, String kind) {
        this.nickName = nickName;
        this.level = level;
        this.blood = blood;
        this.power = power;
        this.defence = defence;
        this.kind = kind;
    }

    /**
     * 获取
     * @return nickName
     */
    public String getNickName() {
        return nickName;
    }

    /**
     * 设置
     * @param nickName
     */
    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    /**
     * 获取
     * @return level
     */
    public int getLevel() {
        return level;
    }

    /**
     * 设置
     * @param level
     */
    public void setLevel(int level) {
        this.level = level;
    }

    /**
     * 获取
     * @return blood
     */
    public int getBlood() {
        return blood;
    }

    /**
     * 设置
     * @param blood
     */
    public void setBlood(int blood) {
        this.blood = blood;
    }

    /**
     * 获取
     * @return power
     */
    public int getPower() {
        return power;
    }

    /**
     * 设置
     * @param power
     */
    public void setPower(int power) {
        this.power = power;
    }

    /**
     * 获取
     * @return defence
     */
    public int getDefence() {
        return defence;
    }

    /**
     * 设置
     * @param defence
     */
    public void setDefence(int defence) {
        this.defence = defence;
    }

    /**
     * 获取
     * @return kind
     */
    public String getKind() {
        return kind;
    }

    /**
     * 设置
     * @param kind
     */
    public void setKind(String kind) {
        this.kind = kind;
    }

    public String toString() {
        return "Monster{nickName = " + nickName + ", level = " + level + ", blood = " + blood + ", power = " + power + ", defence = " + defence + ", kind = " + kind + "}";
    }
}
